﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;
using TpBaseObjects.Properties;
using TpExtensions;

namespace TpBaseObjects.Base {
    public class AeRow {

        #region Members

        private Range myRow;

        #endregion

        #region Constructor

        public AeRow(Range row) {

            myRow = row;

        }

        #endregion

        #region Properties

        #region Projekt

        public DateTime AuftragsDatum {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüAuftragsDatum];
                if ((r1.Value.ToString().Contains("Auf")) | (r1.Value == null)) {
                    return new DateTime(1900, 1, 1);
                }
                return Extensions.Nz(r1.Value, new DateTime(1900, 1, 1));
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüAuftragsDatum];
                r1.Value = value;
            }
        }

        public string ProjektName {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüProjektName];
                return Convert.ToString(r1.Value);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüProjektName];
                r1.Value = value;
            }
        }

        public string ProjektBezeichnung {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüProjektBezeichnung];
                return Convert.ToString(r1.Value);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüProjektBezeichnung];
                r1.Value = value;
            }
        }
        
        #endregion

        #region Adresse

        public string Plz {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AeAdressePlz];
                return Convert.ToString(r1.Value);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AeAdressePlz];
                r1.Value = value;
            }
        }

        public string Ort {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AeAdresseOrt];
                return Convert.ToString(r1.Value);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AeAdresseOrt];
                r1.Value = value;
            }
        }

        public string Straße {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüAdresseStraße];
                return Convert.ToString(r1.Value);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüAdresseStraße];
                r1.Value = value;
            }
        }

        #endregion

        #region Erlös

        public double Erlösminderung {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösMinderung];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösMinderung];
                r1.Value = value;
            }
        }

        public double Forderungsausfall {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösForderungsausfall];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösForderungsausfall];
                r1.Value = value;
            }
        }

        public double RabattGesamt {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattGesamt];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattGesamt];
                r1.Value = value;
            }
        }

        public double RabattLeistungenGesamt {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattLeistungen];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattLeistungen];
                r1.Value = value;
            }
        }

        public double RabattProdukteGesamt {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattProdukte];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösRabattProdukte];
                r1.Value = value;
            }
        }

        public double Schadenfall {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSchadenfall];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSchadenfall];
                r1.Value = value;
            }
        }

        public double SummeHandelsware {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeHandelsware];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeHandelsware];
                r1.Value = value;
            }
        }

        public double SummeProduktion {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeProduktion];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeProduktion];
                r1.Value = value;
            }
        }

        public double SummeMontage {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeMontage];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüErlösSummeMontage];
                r1.Value = value;
            }
        }

        #endregion

        #region Kosten

        public double KostenAdministration {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeAdministration];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeAdministration];
                r1.Value = value;
            }
        }

        public double KostenHandelsware {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeHandelsware];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeHandelsware];
                r1.Value = value;
            }
        }

        public double KostenProduktion {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeProduktion];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeProduktion];
                r1.Value = value;
            }
        }

        public double KostenMontage {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeMontage];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüKostenSummeMontage];
                r1.Value = value;
            }
        }

        #endregion

        #region Zusatzkosten

        public double ZkBaustellenInfrastrukturProzent {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenBaustelleninfrastrukturProzent];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenBaustelleninfrastrukturProzent];
                r1.Value = value;
            }
        }

        public double ZkBaustellenInfrastrukturFix {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenBaustelleninfrastrukturFix];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenBaustelleninfrastrukturFix];
                r1.Value = value;
            }
        }

        public double ZkProvisionDB {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvsionDB];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvsionDB];
                r1.Value = value;
            }
        }

        public double ZkProvisionErlösProzent {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvisionErlösProzent];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvisionErlösProzent];
                r1.Value = value;
            }
        }
        
        public double ZkProvisionErlösFix {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvisionErlösFix];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenProvisionErlösFix];
                r1.Value = value;
            }
        }

        public double ZkErfüllungsgarantie {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenErfüllungsgarantie];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenErfüllungsgarantie];
                r1.Value = value;
            }
        }

        public double ZkHaftrücklass {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenHaftrücklass];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenHaftrücklass];
                r1.Value = value;
            }
        }

        public double ZkSkonto {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenSkonto];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZusatzkostenSkonto];
                r1.Value = value;
            }
        }
        
        #endregion

        #region Zeitaufwand

        public double ZeitaufwandProduktion {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandProdutktion];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandProdutktion];
                r1.Value = value;
            }
        }

        public double ZeitaufwandMontage {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandMontage];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandMontage];
                r1.Value = value;
            }
        }

        public double ZeitaufwandAdministration {
            get {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandAdminsitration];
                return Extensions.Nz(r1.Value, 0);
            }
            set {
                Range r1 = myRow.Cells[1, Settings.Default.AepüZeitaufwandAdminsitration];
                r1.Value = value;
            }
        }

        #endregion

        #endregion

        

    }
}
